
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function jianlou_num($num){
    return $num;
//    if($num < 1000) {
//
//    } else if($num >=1000 && $num < 10000){
//       return round($num/1000,1).'K';
//    } else if ($num >= 10000) {
//       return round($num/10000,2).'W';
//    }
}

function replace_smile($str){
	$str = preg_replace('/:Smile-(.*?)\:/i','<img src="'.base_url('public/face/\1.png').'" />',$str);
	return $str;
}
function get_user_name($username,$uname){
	if($uname){
		return $uname;
	}else{
		return $username;
	}
}
function get_user_name_hide($username,$uname){
	if($uname){
		$s = $uname;
	}else{
		$s = $username;
	}
	return mb_substr($s, 0, 4);
}
function float_num($num) {
    if(is_numeric($num)){
		return floatval(sprintf('%.2f', $num));
	}
}
function url_abc($text){
	$search = "/^[A-Za-z]+$/";
	if ( preg_match( $search, $text ) ) {
        return ( true );
    } else {
        return ( false );
    }
}
function cut_dress($a,$b)
{
	if($a==$b){
		return $a;
	}else{
		return $a.$b;
	}
}
function yincang_num($str){
    return preg_replace('/(\d{3})\d{4}(\d{4})/', '$1**$2', $str);

}

function month_everyday($year,$month){
	$j = date('t', strtotime("".$year."-".$month."-01")); //获取当前月份天数
	$start_time = strtotime(date(''.$year.'-'.$month.'-01'), strtotime("2017-08-01"));  //获取本月第一天时间戳
	$array = array();
	for($i=0;$i<$j;$i++){
		 $array[] = date('Y-m-d',$start_time+$i*86400); //每隔一天赋值给数组
	}
	return $array;
}

function fox_ch_num($money = 0, $is_round = true, $int_unit = '元', $zheng ='') {
    $chs     = array (0, '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
    $uni     = array ('', '拾', '佰', '仟' );
    $dec_uni = array ('角', '分' );
    $exp     = array ('','万','亿');
    $res     = '';
    // 以 元为单位分割
    $parts   = explode ( '.', $money, 2 );
    $int     = isset ( $parts [0] ) ? strval ( $parts [0] ) : 0;
    $dec     = isset ( $parts [1] ) ? strval ( $parts [1] ) : '';
    // 处理小数点
    $dec_len = strlen ( $dec );
    if (isset ( $parts [1] ) && $dec_len > 2) {
        $dec = $is_round ? substr ( strrchr ( strval ( round ( floatval ( "0." . $dec ), 2 ) ), '.' ), 1 ) : substr ( $parts [1], 0, 2 );
    }
    // number= 0.00时，直接返回 0
    if (empty ( $int ) && empty ( $dec )) {
        return '零';
    }
    
    // 整数部分 从右向左
    for($i = strlen ( $int ) - 1, $t = 0; $i >= 0; $t++) {
        $str = '';
        // 每4字为一段进行转化
        for($j = 0; $j < 4 && $i >= 0; $j ++, $i --) {
            $u   = $int{$i} > 0 ? $uni [$j] : '';
            $str = $chs [$int {$i}] . $u . $str;
        }
        $str = rtrim ( $str, '0' );
        $str = preg_replace ( "/0+/", "零", $str );
        $u2  = $str != '' ? $exp [$t] : '';
        $res = $str . $u2 . $res;
    }
    $dec = rtrim ( $dec, '0' );
    // 小数部分 从左向右
    if (!empty ( $dec )) {
        $res .= $int_unit;
        $cnt =  strlen ( $dec );
        for($i = 0; $i < $cnt; $i ++) {
            $u = $dec {$i} > 0 ? $dec_uni [$i] : ''; // 非0的数字后面添加单位
            $res .= $chs [$dec {$i}] . $u;
        }
        if ($cnt == 1) $res .= $zheng;
        $res = rtrim ( $res, '0' ); // 去掉末尾的0
        $res = preg_replace ( "/0+/", "零", $res ); // 替换多个连续的0
    } else {
        $res .= $int_unit . $zheng;
    }
    return $res;
}
function daxie_month($number){
 $number=substr($number,0,2);
 $arr=array("零","一","二","三","四","五","六","七","八","九");
 if(strlen($number)==1){
  $result=$arr[$number];
  }else{
   if($number==10){
    $result="十";
   }else{
    if($number<20){
    $result="十";
    }else{
    $result=$arr[substr($number,0,1)]."十";
    }
    if(substr($number,1,1)!="0"){
    $result.=$arr[substr($number,1,1)]; 
    }
   }
 }
 return $result."月";
}
//规则下的URL安全加密及解密
function fox_fanurl($url){
	$url = str_replace('+','XXXXX',str_replace(')','YYYYY',str_replace('(','ZZZZZ',str_replace(' ','KKKKK',$url))));
	return $url;
}
function fox_deurl($url){
	$url = str_replace('ZZZZZ','(',str_replace('YYYYY',')',str_replace('KKKKK',' ',str_replace('XXXXX','+',$url))));
	return $url;
}

//链接加
function fox_links($str='') {
    if($str=='' or !preg_match('/(http|www\.|@)/i', $str)) { return $str; }
    $lines = explode("\n", $str); $new_text = '';
    while (list($k,$l) = each($lines)) { 
        // replace links:
        $l = preg_replace("/([ \t]|^)www\./i", "\\1http://www.", $l);
        $l = preg_replace("/([ \t]|^)ftp\./i", "\\1ftp://ftp.", $l);
        $l = preg_replace("/(http:\/\/[^ )\r\n!]+)/i", "<a target=\"\\_blank\" href=\"\\1\">\\1</a>", $l);
        $l = preg_replace("/(https:\/\/[^ )\r\n!]+)/i", "<a target=\"\\_blank\" href=\"\\1\">\\1</a>", $l);
        $l = preg_replace("/(ftp:\/\/[^ )\r\n!]+)/i", "<a target=\"\\_blank\" href=\"\\1\">\\1</a>", $l);
        $l = preg_replace("/([-a-z0-9_]+(\.[_a-z0-9-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)+))/i", "<a target=\"\\_blank\" href=\"mailto:\\1\">\\1</a>", $l);
        $new_text .= $l."\n";
    }
    return $new_text;
}

function getExcel($fileName,$headArr,$data,$ex,$dates,$savePath){
	if(empty($data) || !is_array($data)){
	die("无数据可导出，请检查是否正确！");
	}
	if(empty($fileName)){
	exit;
	}
	$date = $dates;
	if($ex=='2003'){
		$fileName .= "_{$date}.xls";
	}elseif($ex=='2007'){
		$fileName .= "_{$date}.xlsx";
	}
	require_once(APPPATH.'third_party/PHPExcel.php');
	require_once(APPPATH.'third_party/phpExcel/Writer/Excel2007.php');  
	require_once(APPPATH.'third_party/phpExcel/Writer/Excel5.php'); 
	require_once(APPPATH.'third_party/PHPExcel/IOFactory.php');
	
	//创建新的PHPExcel对象
	$objPHPExcel = new PHPExcel();
	$objProps = $objPHPExcel->getProperties();

	//设置表头
	$key = ord("A");
	foreach($headArr as $v){
	$colum = chr($key);
	$objPHPExcel->setActiveSheetIndex(0) ->setCellValue($colum.'1', $v);
	$key += 1;
	}

	$column = 2;
	$objActSheet = $objPHPExcel->getActiveSheet();
	foreach($data as $key => $rows){ //行写入
	$span = ord("A");
	foreach($rows as $keyName=>$value){// 列写入
		$j = chr($span);
		$objActSheet->setCellValue($j.$column, $value);
		$span++;
	}
	$column++;
	}
	$objActSheet->getColumnDimension('a')->setWidth(15);//改变此处设置的长度数值 
	$objActSheet->getColumnDimension('f')->setWidth(20);//改变此处设置的长度数值 
	$objActSheet->getColumnDimension('h')->setWidth(20);//改变此处设置的长度数值 
	$objActSheet->getColumnDimension('i')->setWidth(20);//改变此处设置的长度数值 

	$fileName = iconv("utf-8", "gb2312", $fileName);
	//重命名表
	$objPHPExcel->getActiveSheet()->setTitle('Simple');
	//设置活动单指数到第一个表,所以Excel打开这是第一个表
	$objPHPExcel->setActiveSheetIndex(0);
	//将输出重定向到一个客户端web浏览器(Excel2007)
	if($ex=='2003'){
		  //header('Content-Type: application/vnd.ms-excel; charset=UTF-8');  
		  //header("Content-Disposition: attachment; filename=\"$fileName\"");
		  //header('Cache-Control: max-age=0');  
		  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');  
	  }elseif($ex=='2007'){
		  //header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8');
		  //header("Content-Disposition: attachment; filename=\"$fileName\"");
		  //header('Cache-Control: max-age=0');
		  $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
	  }
	$savename=$savePath.$fileName;
	//if(!empty($_GET['excel'])){
	//	$objWriter->save('php://output'); //文件通过浏览器下载
	//}else{
		 $objWriter->save($savename); //脚本方式运行，保存在当前目录
	//}
	return $savename;
	exit;
}

function fox_chines_str($str){
	preg_match_all('/[\x{4e00}-\x{9fff}]|[\，]|[\。]|[\！]|[\？]+/u', $str, $matches);
	$str = join('', $matches[0]);
	return $str;
}

/**
 * 截取中英混排字符串
 * @param (string) $string
 * @param (int) $length
 * @param (string) $dot
 * @param (string) $charset
 */
function fox_substr( $string, $length, $dot = '...', $charset='utf-8' ) {
	$slen = strlen($string);
    if( $slen <= $length ) {
        return $string;
    }
	if( function_exists( 'mb_substr' ) ) {
		return mb_substr( $string, 0, $length, $charset ) . $dot;
	}
    $strcut = '';
    if(strtolower($charset) == 'utf-8') {
        $n = $tn = $noc = 0;
        while($n < $slen) {
            $t = ord($string[$n]);
            if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) {
                $tn = 1; $n++; $noc++;
            } elseif(194 <= $t && $t <= 223) {
                $tn = 2; $n += 2; $noc += 1;
            } elseif(224 <= $t && $t < 239) {
                $tn = 3; $n += 3; $noc += 1;
            } elseif(240 <= $t && $t <= 247) {
                $tn = 4; $n += 4; $noc += 1;
            } elseif(248 <= $t && $t <= 251) {
                $tn = 5; $n += 5; $noc += 1;
            } elseif($t == 252 || $t == 253) {
                $tn = 6; $n += 6; $noc += 1;
            } else {
                $n++;
            }
            if($noc >= $length) {
                break;
            }
        }
        if($noc > $length) {
            $n -= $tn;
        }
        $strcut = substr($string, 0, $n);
    } else {
        for($i = 0; $i < $length; $i++) {
            $strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
        }
    }
    
    return $strcut.$dot;
}

/**
 * 清除HTML标记
 *
 * @param	string	$str
 * @return  string
 */
function cleanhtml($str)
{
	$str = strip_tags($str);
	$str = htmlspecialchars($str);
	$str=preg_replace("/\s+/"," ", $str); //过滤多余回车
	 $str = preg_replace("/ /","",$str);
	 $str = preg_replace("/&nbsp;/","",$str);
	 $str = preg_replace("/　/","",$str);
	 $str = preg_replace("/\r\n/","",$str);
	 $str = str_replace(chr(13),"",$str);
	 $str = str_replace(chr(10),"",$str);
	 $str = str_replace(chr(9),"",$str);
	return $str;
}

//过滤空白
function trimall($str){
    $qian=array(" ","　","\t","\n","\r");
    return str_replace($qian, '', $str);   
}

function check_auth()
{
	$url = 'http://www.kuaiwww.com/authorize/check_auth/'.get_domain();
	if(function_exists('file_get_contents')) {
		$data=file_get_contents($url);
	} else {
		$ch = curl_init();
		$timeout = 5; 
		curl_setopt ($ch, CURLOPT_URL, $url);
		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
		curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
		$data = curl_exec($ch);
		curl_close($ch);
	}
	$data = json_decode($data);
	return $data->product;
}
//长度范围
function e_range($str, $min, $max)
{
	$len = strlen($str);
	if ($len >= $min && $len < $max) {
		return true;
	}
	return false;
}
//长度范围(中英文混合)
function mix_range($str, $min, $max)
{
	$len = (strlen($str) + mb_strlen($str, 'utf8')) / 2;
	if ($len >= $min && $len <= $max) {
		return true;
	}
	return false;
}
//QQ号
function is_qq($str)
{
	if (preg_match('/[1-9][0-9]{4,10}/', $str)) {
		return true;
	}
	return false;
}
//手机号码验证
function checkMobile($mobilephone){
        if(preg_match("/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/",$mobilephone)){
		    return true;
        }else{
			return false;
        } 
}
//邮箱验证类
function validateEmail($email){
$pattern="/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/";  //[ch]定义验证email正则表达式
       if(preg_match($pattern,$email,$counts)){
            return true;
       }else{
            return false;
       }
 }
 
//sms接口相关结束，发送短信
function SendShouji($a,$b,$c,$d,$e){	
	$target = "http://106.ihuyi.cn/webservice/sms.php?method=Submit";	
	//替换成自己的测试账号,参数顺序和wenservice对应
	$post_data = "account=".$a."&password=".$b."&mobile=".$c."&content=".urlencode($d);
	$gets = ihuyi_Post($post_data,$target);
	$gets_arr = xml_to_array($gets);
	if ($gets_arr['SubmitResult']['code'] == 2){
		return true;
	}else{
		return false;
	}
}

function xml_to_array($xml){
	$reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/";
	if(preg_match_all($reg, $xml, $matches)){
		$count = count($matches[0]);
		for($i = 0; $i < $count; $i++){
		$subxml= $matches[2][$i];
		$key = $matches[1][$i];
			if(preg_match( $reg, $subxml )){
				$arr[$key] = xml_to_array( $subxml );
			}else{
				$arr[$key] = $subxml;
			}
		}
	}
	return @$arr;
}

//sms接口相关
 function ihuyi_Post($curlPost,$url){
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_URL, $url);
		curl_setopt($curl, CURLOPT_HEADER, false);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($curl, CURLOPT_NOBODY, true);
		curl_setopt($curl, CURLOPT_POST, true);
		curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
		$return_str = curl_exec($curl);
		curl_close($curl);
		return $return_str;
}

function get_domain($url=''){
	$host=$url?$url:@$_SERVER[HTTP_HOST]; 
	$host=strtolower($host); 
	if(strpos($host,'/')!==false){ 
		$parse = @parse_url($host); 
		$host = $parse['host']; 
	}
	$topleveldomaindb=array('com','edu','gov','int','mil','net','org','biz','info','pro','name','museum','coop','aero','xxx','idv','mobi','cc','me','cn','tv','in','hk','de','us','tw');
	$str=''; 
	foreach($topleveldomaindb as $v){ 
		$str.=($str ? '|' : '').$v;
	} 
	$matchstr="[^\.]+\.(?:(".$str.")|\w{2}|((".$str.")\.\w{2}))$";
	if(preg_match("/".$matchstr."/ies",$host,$matchs)){ 
		$domain=$matchs['0'];
	}else{ 
		$domain=$host; 
	}
	return $domain; 
}

function filter_check ($str)
{
	
	$pattern="/<pre[^>]*>(.*?)<\/pre>/si";
	preg_match_all($pattern, $str, $matches);
	$str=htmlspecialchars_decode($str);
	$str=stripslashes($str);
	if($matches[1]){
		foreach($matches[1] as $v){
			$replace[]= addslashes(htmlspecialchars(trim($v)));
		}
		$str = str_replace($matches[1], $replace, $str);
	} else{
		$str=strip_tags($str,"<img> <pre> <a> <font> <span> <em>");
	}
	$str = nl2br($str);
	
	return $str;
}

//过滤
function filter_code($str)
{
	$str=htmlspecialchars_decode($str);
	$pattern="/<pre[^>]*>(.*?)<\/pre>/si";
	preg_match_all($pattern, $str, $matches);
	if($matches[1]){
		foreach($matches[1] as $v){
			$replace= trim(htmlentities($v));
			$str = str_replace($v, $replace, $str);
		}
		$str =strip_tags($str,"<img> <pre> <a> <font> <span> <em> <p> <b>");
	}else{
		$str =strip_tags($str,"<img> <pre> <a> <font> <span> <em> <p> <b>");
		$str = trim(nl2br($str));
	}
	return $str;
}

function br2nl($text)
{
	return preg_replace('/<br\\s*?\/??>/i', '', $text);
}
function xss_clean($input_str) {
    $return_str = str_replace( array('<','>',"'",'"',')','('), array('&lt;','&gt;','&apos;','&#x22;','&#x29;','&#x28;'), $input_str );
    $return_str = str_ireplace( '%3Cscript', '', $return_str );
    return $return_str;
}

function xss_clean3($str)
{

if (isset($str)){
	$str = trim($str);  //清理空格
	$str = strip_tags($str);   //过滤html标签
	$str = htmlspecialchars($str);   //将字符内容转化为html实体
	$str = addslashes($str);
	return $str;
}


}

function xss_clean1($data)
{
        // Fix &entity\n;
        $data = str_replace(array('&amp;','&lt;','&gt;'), array('&amp;amp;','&amp;lt;','&amp;gt;'), $data);
        $data = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $data);
        $data = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $data);
        $data = html_entity_decode($data, ENT_COMPAT, 'UTF-8');

        // Remove any attribute starting with "on" or xmlns
        $data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data);

        // Remove javascript: and vbscript: protocols
        $data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data);
        $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data);
        $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data);

        // Only works in IE: <span style="width: expression(alert('Ping!'));"></span>
        $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
        $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data);
        $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', '$1>', $data);

        // Remove namespaced elements (we do not need them)
        $data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data);

        do
        {
                // Remove really unwanted tags
                $old_data = $data;
                $data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data);
        }
        while ($old_data !== $data);

        // we are done...
        return $data;
}

function randkey($length)
{
	 $pattern='1234567890abcdefghijklmnopqrstuvwxyz$#&^@!';
	 $key='';
	 for($i=0;$i<$length;$i++)
	 {
	   $key.= $pattern{mt_rand(0,35)};    //生成php随机数
	 }
	 return $key;
}
function csrf_hidden(){
	$ci = &get_instance();
	$name = $ci->security->get_csrf_token_name();
	$val = $ci->security->get_csrf_hash();
	echo "<input type=\"hidden\" id=\"$name\" class=\"$name\" name=\"$name\" value=\"$val\" />";
}
function csrf_name(){
	$ci = &get_instance();
	$name = $ci->security->get_csrf_token_name();
	return $name;
}

function csrf_value(){
	$ci = &get_instance();
	$val = $ci->security->get_csrf_hash();
	return $val;
}
function get_url_content($url)
{
	if(function_exists('file_get_contents')){
		return file_get_contents($url);
	} elseif(function_exists('curl_init')){
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL,$url);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		return curl_exec($ch);
	}
}

/*生成盐salt*/

function get_salt($length=-6){
	return substr(uniqid(rand()), $length);
}

/*生成密码*/

function password_dohash($password,$salt)
{
	$salt=$salt?$salt:get_salt();
	return md5(md5($password).$salt);
}
/*返回信息*/
function show_message($message='', $url='', $status = 2, $heading='提示信息', $time = 1800)
{
    include FCPATH.'themes/errors/html/show_message.php';
    exit;
}

////获得本地真实IP
function get_onlineip() {
    $ip='bad ip';
	if(!empty($_SERVER['HTTP_CLIENT_IP'])){
		return is_ip($_SERVER['HTTP_CLIENT_IP'])?$_SERVER['HTTP_CLIENT_IP']:$ip;
	}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
		return is_ip($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$ip;
	}else{
		return is_ip($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:$ip;
	}
}
function is_ip($str){
	$ip=explode('.',$str);
	for($i=0;$i<count($ip);$i++){  
		if($ip[$i]>255){  
			return false;  
		}  
	}  
	return preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',$str);  
     
}

/*补全代码*/
function closetags($html) { 
	// 不需要补全的标签 
	$arr_single_tags = array('meta', 'img', 'br', 'link', 'area'); 
	// 匹配开始标签 
	preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result); 
	$openedtags = $result[1]; 
	// 匹配关闭标签 
	preg_match_all('#</([a-z]+)>#iU', $html, $result); 
	$closedtags = $result[1]; 
	// 计算关闭开启标签数量，如果相同就返回html数据 
	$len_opened = count($openedtags); 
	if (count($closedtags) == $len_opened) { 
		return $html; 
	} 
	// 把排序数组，将最后一个开启的标签放在最前面 
	$openedtags = array_reverse($openedtags); 
	// 遍历开启标签数组 
	for ($i = 0; $i < $len_opened; $i++) { 
		// 如果需要补全的标签 
		if (!in_array($openedtags[$i], $arr_single_tags)) { 
		// 如果这个标签不在关闭的标签中 
			if (!in_array($openedtags[$i], $closedtags)) { 
			// 直接补全闭合标签 
				$html .= '</' . $openedtags[$i] . '>'; 
			} else { 
				unset($closedtags[array_search($openedtags[$i], $closedtags)]); 
			} 
		} 
	} 
	return $html; 
}

function strip_url_tags($str)
{
	$str=preg_replace("/<a[^>]*href=[^>]*>|<\/[^a]*a[^>]*>/i","\\2",$str);
	return $str;
}

function get_tree_array(&$data, $parentId=0)
{
    $category = array();
    foreach ($data as $key=>$value)
    {
        if ($value['pid'] == $parentId)
        {
            unset($data[$key]);
            $value['child'] = category($data, $value['id']);
            $category[] = $value;
        }
    }
    return $category;
}
function get_tree(&$data, $parentId=0)
{
	global $str;
    $str .= '<ul>';
    foreach ($data as $key=>$value)
    {
        if ($value['pid'] == $parentId)
        {
            unset($data[$key]);
            $str.="<li>|--<a href='/'>".$value['name'].'</a></li>';
            get_tree($data, $value['id']);
        }
    }
    $str .= '</ul>';
    return $str;
}

/**
 * $string 明文或密文
 * $operation 加密ENCODE或解密DECODE
 * $key 密钥
 * $expiry 密钥有效期
 */ 
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
    // 动态密匙长度，相同的明文会生成不同密文就是依靠动态密匙
    // 加入随机密钥，可以令密文无任何规律，即便是原文和密钥完全相同，加密结果也会每次不同，增大破解难度。
    // 取值越大，密文变动规律越大，密文变化 = 16 的 $ckey_length 次方
    // 当此值为 0 时，则不产生随机密钥
    $ckey_length = 4;
 
    // 密匙
    $key = md5($key ? $key : $this->config->item('encryption_key')); 
 
    // 密匙a会参与加解密
    $keya = md5(substr($key, 0, 16));
    // 密匙b会用来做数据完整性验证
    $keyb = md5(substr($key, 16, 16));
    // 密匙c用于变化生成的密文
    $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
    // 参与运算的密匙
    $cryptkey = $keya.md5($keya.$keyc);
    $key_length = strlen($cryptkey);
    // 明文，前10位用来保存时间戳，解密时验证数据有效性，10到26位用来保存$keyb(密匙b)，解密时会通过这个密匙验证数据完整性
    // 如果是解码的话，会从第$ckey_length位开始，因为密文前$ckey_length位保存 动态密匙，以保证解密正确
    $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
    $string_length = strlen($string);
    $result = '';
    $box = range(0, 255);
    $rndkey = array();
    // 产生密匙簿
    for($i = 0; $i <= 255; $i++) {
        $rndkey[$i] = ord($cryptkey[$i % $key_length]);
    }
    // 用固定的算法，打乱密匙簿，增加随机性，好像很复杂，实际上并不会增加密文的强度
    for($j = $i = 0; $i < 256; $i++) {
        $j = ($j + $box[$i] + $rndkey[$i]) % 256;
        $tmp = $box[$i];
        $box[$i] = $box[$j];
        $box[$j] = $tmp;
    }
    // 核心加解密部分
    for($a = $j = $i = 0; $i < $string_length; $i++) {
        $a = ($a + 1) % 256;
        $j = ($j + $box[$a]) % 256;
        $tmp = $box[$a];
        $box[$a] = $box[$j];
        $box[$j] = $tmp;
        // 从密匙簿得出密匙进行异或，再转成字符
        $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
    }
    if($operation == 'DECODE') {
        // substr($result, 0, 10) == 0 验证数据有效性
        // substr($result, 0, 10) - time() > 0 验证数据有效性
        // substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16) 验证数据完整性
        // 验证数据有效性，请看未加密明文的格式
        if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
            return substr($result, 26);
        } else {
            return '';
        }
    } else {
        // 把动态密匙保存在密文里，这也是为什么同样的明文，生产不同密文后能解密的原因
        // 因为加密后的密文可能是一些特殊字符，复制过程可能会丢失，所以用base64编码
		$result = str_replace('=', '', base64_encode($result));
		//$result = str_replace('+', '', $result);
        return $keyc.$result;
    }
}

//生成友好时间形式
function  friendly_date( $from ){
	static $now = NULL;
	$now == NULL && $now = time();
	! is_numeric( $from ) && $from = strtotime( $from );
	$seconds = $now - $from;
	$minutes = floor( $seconds / 60 );
	$hours   = floor( $seconds / 3600 );
	$day     = round( ( strtotime( date( 'Y-m-d', $now ) ) - strtotime( date( 'Y-m-d', $from ) ) ) / 86400 );
	if( $seconds == 0 ){
		return '刚刚';
	}
	if( ( $seconds >= 0 ) && ( $seconds <= 60 ) ){
		return "{$seconds}秒前";
	}
	if( ( $minutes >= 0 ) && ( $minutes <= 60 ) ){
		return "{$minutes}分钟前";
	}
	if( ( $hours >= 0 ) && ( $hours <= 24 ) ){
		return "{$hours}小时前";
	}
	if( ( date( 'Y' ) - date( 'Y', $from ) ) > 0 ) {
		return date( 'Y-m-d', $from );
	}
	
	switch( $day ){
		case 0:
			return date( '今天H:i', $from );
		break;
		
		case 1:
			return date( '昨天H:i', $from );
		break;
		
		default:
			//$day += 1;
			return "{$day} 天前";
		break;
	}
}

function str_len($str, $charset='utf-8')
{
    if($charset=='utf-8') $str = iconv('utf-8','gb2312',$str);
    $num = strlen($str);
    $cnNum = 0;
    for($i=0;$i<$num;$i++){
        if(ord(substr($str,$i+1,1))>127){
            $cnNum++;
            $i++;
        }
    }
    $enNum = $num-($cnNum*2);
    $number = ($enNum/2)+$cnNum;
    return ceil($number);
}

if(!function_exists('array_column')){
    function array_column($input, $columnKey, $indexKey=null){ 
        $columnKeyIsNumber      = (is_numeric($columnKey)) ? true : false; 
        $indexKeyIsNull         = (is_null($indexKey)) ? true : false; 
        $indexKeyIsNumber       = (is_numeric($indexKey)) ? true : false; 
        $result                 = array(); 
        foreach((array)$input as $key=>$row){ 
            if($columnKeyIsNumber){ 
                $tmp            = array_slice($row, $columnKey, 1); 
                $tmp            = (is_array($tmp) && !empty($tmp)) ? current($tmp) : null; 
            }else{ 
                $tmp            = isset($row[$columnKey]) ? $row[$columnKey] : null; 
            } 
            if(!$indexKeyIsNull){ 
                if($indexKeyIsNumber){ 
                    $key        = array_slice($row, $indexKey, 1); 
                    $key        = (is_array($key) && !empty($key)) ? current($key) : null; 
                    $key        = is_null($key) ? 0 : $key; 
                }else{ 
                    $key        = isset($row[$indexKey]) ? $row[$indexKey] : 0; 
                } 
            } 
            $result[$key]       = $tmp; 
        } 
        return $result; 
    } 
}

function is_today($time)
{
	$date = date('Y-m-d',$time);
	$today = date('Y-m-d');
	if($date==$today){
		return TRUE;
	}else{
		return FALSE;
	}

}

//php获取中文字符拼音首字母
function getFirstCharter($str){
    if(empty($str)){return '';}
    $fchar=ord($str{0});
    if($fchar>=ord('A')&&$fchar<=ord('z')) return strtoupper($str{0});
    $s1=iconv('UTF-8','gb2312',$str);
    $s2=iconv('gb2312','UTF-8',$s1);
    $s=$s2==$str?$s1:$str;
    $asc=ord($s{0})*256+ord($s{1})-65536;
    if($asc>=-20319&&$asc<=-20284) return 'A';
    if($asc>=-20283&&$asc<=-19776) return 'B';
    if($asc>=-19775&&$asc<=-19219) return 'C';
    if($asc>=-19218&&$asc<=-18711) return 'D';
    if($asc>=-18710&&$asc<=-18527) return 'E';
    if($asc>=-18526&&$asc<=-18240) return 'F';
    if($asc>=-18239&&$asc<=-17923) return 'G';
    if($asc>=-17922&&$asc<=-17418) return 'H';
    if($asc>=-17417&&$asc<=-16475) return 'J';
    if($asc>=-16474&&$asc<=-16213) return 'K';
    if($asc>=-16212&&$asc<=-15641) return 'L';
    if($asc>=-15640&&$asc<=-15166) return 'M';
    if($asc>=-15165&&$asc<=-14923) return 'N';
    if($asc>=-14922&&$asc<=-14915) return 'O';
    if($asc>=-14914&&$asc<=-14631) return 'P';
    if($asc>=-14630&&$asc<=-14150) return 'Q';
    if($asc>=-14149&&$asc<=-14091) return 'R';
    if($asc>=-14090&&$asc<=-13319) return 'S';
    if($asc>=-13318&&$asc<=-12839) return 'T';
    if($asc>=-12838&&$asc<=-12557) return 'W';
    if($asc>=-12556&&$asc<=-11848) return 'X';
    if($asc>=-11847&&$asc<=-11056) return 'Y';
    if($asc>=-11055&&$asc<=-10247) return 'Z';
    return null;
}


function Pinyin($_String, $_Code='UTF8'){ //GBK页面可改为gb2312，其他随意填写为UTF8
	$_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha".
					"|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|".
					"cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er".
					"|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui".
					"|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang".
					"|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang".
					"|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue".
					"|lun|luo|ma|mai|man|mang|mao|me|mei|men|meng|mi|mian|miao|mie|min|ming|miu|mo|mou|mu|na|nai|nan|nang|nao|ne".
					"|nei|nen|neng|ni|nian|niang|niao|nie|nin|ning|niu|nong|nu|nv|nuan|nue|nuo|o|ou|pa|pai|pan|pang|pao|pei|pen".
					"|peng|pi|pian|piao|pie|pin|ping|po|pu|qi|qia|qian|qiang|qiao|qie|qin|qing|qiong|qiu|qu|quan|que|qun|ran|rang".
					"|rao|re|ren|reng|ri|rong|rou|ru|ruan|rui|run|ruo|sa|sai|san|sang|sao|se|sen|seng|sha|shai|shan|shang|shao|".
					"she|shen|sheng|shi|shou|shu|shua|shuai|shuan|shuang|shui|shun|shuo|si|song|sou|su|suan|sui|sun|suo|ta|tai|".
					"tan|tang|tao|te|teng|ti|tian|tiao|tie|ting|tong|tou|tu|tuan|tui|tun|tuo|wa|wai|wan|wang|wei|wen|weng|wo|wu".
					"|xi|xia|xian|xiang|xiao|xie|xin|xing|xiong|xiu|xu|xuan|xue|xun|ya|yan|yang|yao|ye|yi|yin|ying|yo|yong|you".
					"|yu|yuan|yue|yun|za|zai|zan|zang|zao|ze|zei|zen|zeng|zha|zhai|zhan|zhang|zhao|zhe|zhen|zheng|zhi|zhong|".
					"zhou|zhu|zhua|zhuai|zhuan|zhuang|zhui|zhun|zhuo|zi|zong|zou|zu|zuan|zui|zun|zuo";
	$_DataValue = "-20319|-20317|-20304|-20295|-20292|-20283|-20265|-20257|-20242|-20230|-20051|-20036|-20032|-20026|-20002|-19990".
					"|-19986|-19982|-19976|-19805|-19784|-19775|-19774|-19763|-19756|-19751|-19746|-19741|-19739|-19728|-19725".
					"|-19715|-19540|-19531|-19525|-19515|-19500|-19484|-19479|-19467|-19289|-19288|-19281|-19275|-19270|-19263".
					"|-19261|-19249|-19243|-19242|-19238|-19235|-19227|-19224|-19218|-19212|-19038|-19023|-19018|-19006|-19003".
					"|-18996|-18977|-18961|-18952|-18783|-18774|-18773|-18763|-18756|-18741|-18735|-18731|-18722|-18710|-18697".
					"|-18696|-18526|-18518|-18501|-18490|-18478|-18463|-18448|-18447|-18446|-18239|-18237|-18231|-18220|-18211".
					"|-18201|-18184|-18183|-18181|-18012|-17997|-17988|-17970|-17964|-17961|-17950|-17947|-17931|-17928|-17922".
					"|-17759|-17752|-17733|-17730|-17721|-17703|-17701|-17697|-17692|-17683|-17676|-17496|-17487|-17482|-17468".
					"|-17454|-17433|-17427|-17417|-17202|-17185|-16983|-16970|-16942|-16915|-16733|-16708|-16706|-16689|-16664".
					"|-16657|-16647|-16474|-16470|-16465|-16459|-16452|-16448|-16433|-16429|-16427|-16423|-16419|-16412|-16407".
					"|-16403|-16401|-16393|-16220|-16216|-16212|-16205|-16202|-16187|-16180|-16171|-16169|-16158|-16155|-15959".
					"|-15958|-15944|-15933|-15920|-15915|-15903|-15889|-15878|-15707|-15701|-15681|-15667|-15661|-15659|-15652".
					"|-15640|-15631|-15625|-15454|-15448|-15436|-15435|-15419|-15416|-15408|-15394|-15385|-15377|-15375|-15369".
					"|-15363|-15362|-15183|-15180|-15165|-15158|-15153|-15150|-15149|-15144|-15143|-15141|-15140|-15139|-15128".
					"|-15121|-15119|-15117|-15110|-15109|-14941|-14937|-14933|-14930|-14929|-14928|-14926|-14922|-14921|-14914".
					"|-14908|-14902|-14894|-14889|-14882|-14873|-14871|-14857|-14678|-14674|-14670|-14668|-14663|-14654|-14645".
					"|-14630|-14594|-14429|-14407|-14399|-14384|-14379|-14368|-14355|-14353|-14345|-14170|-14159|-14151|-14149".
					"|-14145|-14140|-14137|-14135|-14125|-14123|-14122|-14112|-14109|-14099|-14097|-14094|-14092|-14090|-14087".
					"|-14083|-13917|-13914|-13910|-13907|-13906|-13905|-13896|-13894|-13878|-13870|-13859|-13847|-13831|-13658".
					"|-13611|-13601|-13406|-13404|-13400|-13398|-13395|-13391|-13387|-13383|-13367|-13359|-13356|-13343|-13340".
					"|-13329|-13326|-13318|-13147|-13138|-13120|-13107|-13096|-13095|-13091|-13076|-13068|-13063|-13060|-12888".
					"|-12875|-12871|-12860|-12858|-12852|-12849|-12838|-12831|-12829|-12812|-12802|-12607|-12597|-12594|-12585".
					"|-12556|-12359|-12346|-12320|-12300|-12120|-12099|-12089|-12074|-12067|-12058|-12039|-11867|-11861|-11847".
					"|-11831|-11798|-11781|-11604|-11589|-11536|-11358|-11340|-11339|-11324|-11303|-11097|-11077|-11067|-11055".
					"|-11052|-11045|-11041|-11038|-11024|-11020|-11019|-11018|-11014|-10838|-10832|-10815|-10800|-10790|-10780".
					"|-10764|-10587|-10544|-10533|-10519|-10331|-10329|-10328|-10322|-10315|-10309|-10307|-10296|-10281|-10274".
					"|-10270|-10262|-10260|-10256|-10254";
	$_TDataKey   = explode('|', $_DataKey);
	$_TDataValue = explode('|', $_DataValue);
	$_Data = array_combine($_TDataKey, $_TDataValue);
	arsort($_Data);
	reset($_Data);
	if($_Code!= 'gb2312') $_String = _U2_Utf8_Gb($_String);
	$_Res = '';
	for($i=0; $i<strlen($_String); $i++) {
			$_P = ord(substr($_String, $i, 1));
			if($_P>160) {
					$_Q = ord(substr($_String, ++$i, 1)); $_P = $_P*256 + $_Q - 65536;
			}
			$_Res .= _Pinyin($_P, $_Data);
	}
	return preg_replace("/[^a-z0-9]*/", '', $_Res);
}
function _Pinyin($_Num, $_Data){
	if($_Num>0 && $_Num<160 ){
			return chr($_Num);
	}elseif($_Num<-20319 || $_Num>-10247){
			return '';
	}else{
			foreach($_Data as $k=>$v){ if($v<=$_Num) break; }
			return $k;
	}
}
function _U2_Utf8_Gb($_C){
	$_String = '';
	if($_C < 0x80){
			$_String .= $_C;
	}elseif($_C < 0x800) {
			$_String .= chr(0xC0 | $_C>>6);
			$_String .= chr(0x80 | $_C & 0x3F);
	}elseif($_C < 0x10000){
			$_String .= chr(0xE0 | $_C>>12);
			$_String .= chr(0x80 | $_C>>6 & 0x3F);
			$_String .= chr(0x80 | $_C & 0x3F);
	}elseif($_C < 0x200000) {
			$_String .= chr(0xF0 | $_C>>18);
			$_String .= chr(0x80 | $_C>>12 & 0x3F);
			$_String .= chr(0x80 | $_C>>6 & 0x3F);
			$_String .= chr(0x80 | $_C & 0x3F);
	}
	return iconv('UTF-8', 'GB2312', $_String);
}

 function array_unique_fb($array2D){
	 foreach ($array2D as $v){
		 $v = join(",",$v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
		 $temp[] = $v;
	 }
	 $temp = array_unique($temp);    //去掉重复的字符串,也就是重复的一维数组
	foreach ($temp as $k => $v){
		$temp[$k] = explode(",",$v);   //再将拆开的数组重新组装
	}
	return $temp;
}

function assoc_unique($arr, $key)
 {
   $tmp_arr = array();
   foreach($arr as $k => $v)
  {
	 if(in_array($v[$key], $tmp_arr))//搜索$v[$key]是否在$tmp_arr数组中存在，若存在返回true
	{
	   unset($arr[$k]);
	}
  else {
	  $tmp_arr[] = $v[$key];
	}
  }
sort($arr); //sort函数对数组进行排序
return $arr;
}

function shuffle_assoc($list) {  
	if (!is_array($list)) return $list;  
	   
	$keys = array_keys($list);  
	shuffle($keys);  
	$random = array();  
	foreach ($keys as $key)  
	$random[$key] = shuffle_assoc($list[$key]);  
	return $random;  
 }
 
function party_time($start_time,$end_time,$area=''){
	if($start_time<time() && $end_time<time()){
		return '<span class="btn btn-warning '.$area.'">已经结束</span>';
	}
	if($start_time<time() && $end_time>=time()){
		return '<span class="btn btn-success '.$area.'">正在进行</span>';
	}
	if($start_time>=time() && $end_time>=time()){
		return '<span class="btn btn-info '.$area.'">即将开始</span>';
	}
}

function users_sex_biao($sex){
	if($sex==0){
		return '--';
	}
	if($sex==1){
		return '<span class="text-blue"><i class="fa fa-mars-stroke-v" aria-hidden="true"></i></span>';
	}
	if($sex==2){
		return '<span class="text-pink"><i class="fa fa-venus" aria-hidden="true"></i></span>';
	}
}


function unique_arr($array2D,$stkeep=false,$ndformat=true)
{
    // 判断是否保留一级数组键 (一级数组键可以为非数字)
    if($stkeep) $stArr = array_keys($array2D);
    // 判断是否保留二级数组键 (所有二级数组键必须相同)
    if($ndformat) $ndArr = array_keys(end($array2D));
    //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
    foreach ($array2D as $v){
        $v = join(",",$v); 
        $temp[] = $v;
    }
    //去掉重复的字符串,也就是重复的一维数组
    $temp = array_unique($temp); 
    //再将拆开的数组重新组装
    foreach ($temp as $k => $v)
    {
        if($stkeep) $k = $stArr[$k];
        if($ndformat)
        {
            $tempArr = explode(",",$v); 
            foreach($tempArr as $ndkey => $ndval) $output[$k][$ndArr[$ndkey]] = $ndval;
        }
        else $output[$k] = explode(",",$v); 
    }
    return $output;
}

function copy_dir($src,$dst) {
  $dir = opendir($src);
  @mkdir($dst);
  while(false !== ( $file = readdir($dir)) ) {
    if (( $file != '.' ) && ( $file != '..' )) {
      if ( is_dir($src . '/' . $file) ) {
        copy_dir($src . '/' . $file,$dst . '/' . $file);
        continue;
      }
      else {
        copy($src . '/' . $file,$dst . '/' . $file);
      }
    }
  }
  closedir($dir);
}

function deldir($dir) {
  //先删除目录下的文件：
  $dh=opendir($dir);
  while ($file=readdir($dh)) {
    if($file!="." && $file!="..") {
      $fullpath=$dir."/".$file;
      if(!is_dir($fullpath)) {
          unlink($fullpath);
      } else {
          deldir($fullpath);
      }
    }
  }
  
  closedir($dh);
  //删除当前文件夹：
  if(rmdir($dir)) {
    return true;
  } else {
    return false;
  }
}

function CheckSubstrs($substrs,$text){  
	foreach($substrs as $substr)  
	if(false!==strpos($text,$substr)){  
	return true;  
	}  
	return false;  
}

function isMobile(){  
	$useragent=isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';  
	$useragent_commentsblock=preg_match('|\(.*?\)|',$useragent,$matches)>0?$matches[0]:'';  	 

	$mobile_os_list=array('Google Wireless Transcoder','Windows CE','WindowsCE','Symbian','Android','armv6l','armv5','Mobile','CentOS','mowser','AvantGo','Opera Mobi','J2ME/MIDP','Smartphone','Go.Web','Palm','iPAQ');
	$mobile_token_list=array('Profile/MIDP','Configuration/CLDC-','160×160','176×220','240×240','240×320','320×240','UP.Browser','UP.Link','SymbianOS','PalmOS','PocketPC','SonyEricsson','Nokia','BlackBerry','Vodafone','BenQ','Novarra-Vision','Iris','NetFront','HTC_','Xda_','SAMSUNG-SGH','Wapaka','DoCoMo','iPhone','iPod');  
	 
	$found_mobile=CheckSubstrs($mobile_os_list,$useragent_commentsblock) ||  
	 CheckSubstrs($mobile_token_list,$useragent);  
	 
	if ($found_mobile){  
		return true;  
	}else{  
		return false;  
	}  

}

function get_words_tags_arr($title)
{
	require_once APPPATH . 'third_party/words/pscws4.class.php';
	$pscws = new PSCWS4();
	$pscws->set_dict(APPPATH . 'third_party/words/scws/dict.utf8.xdb');
	$pscws->set_rule(APPPATH . 'third_party/words/scws/rules.utf8.ini');
	$pscws->set_ignore(true);
	$pscws->send_text($title);
	$words = $pscws->get_tops(5);
	$tags = array();
	foreach ($words as $val) {
		$tags[] = $val['word'];
	}
	$pscws->close();
	return $tags;
}

function sctonum($num, $double = 5){  
    if(false !== stripos($num, "e")){  
        $a = explode("e",strtolower($num));  
        return bcmul($a[0], bcpow(10, $a[1], $double), $double);  
    }  
}  

/**
 *计算某个经纬度的周围某段距离的正方形的四个点
 *
 *@param lng float 经度
 *@param lat float 纬度
 *@param distance float 该点所在圆的半径，该圆与此正方形内切，默认值为0.5千米
 *@return array 正方形的四个点的经纬度坐标
 */
 function returnSquarePoint($lng, $lat,$distance = 0.5){
	$EARTH_RADIUS = '6378.137';
	$dlng =  2 * asin(sin($distance / (2 * $EARTH_RADIUS)) / cos(deg2rad($lat)));
	$dlng = rad2deg($dlng);

	$dlat = $distance/$EARTH_RADIUS;
	$dlat = rad2deg($dlat);

	return array(
		'left-top'=>array('lat'=>$lat + $dlat,'lng'=>$lng-$dlng),
		'right-top'=>array('lat'=>$lat + $dlat, 'lng'=>$lng + $dlng),
		'left-bottom'=>array('lat'=>$lat - $dlat, 'lng'=>$lng - $dlng),
		'right-bottom'=>array('lat'=>$lat - $dlat, 'lng'=>$lng + $dlng)
		);
 }

 /**
 *求两个已知经纬度之间的距离,单位为千米
 *@param lng1,lng2 经度
 *@param lat1,lat2 纬度
 *@return float 距离，单位千米
 **/
function fox_distance($lng1,$lat1,$lng2,$lat2, $decimal = 2)//根据经纬度计算距离
{
	//将角度转为弧度
	$radLat1=deg2rad($lat1);
	$radLat2=deg2rad($lat2);
	$radLng1=deg2rad($lng1);
	$radLng2=deg2rad($lng2);
	$a=$radLat1-$radLat2;//两纬度之差,纬度<90
	$b=$radLng1-$radLng2;//两经度之差纬度<180
	$s=2*asin(sqrt(pow(sin($a/2),2)+cos($radLat1)*cos($radLat2)*pow(sin($b/2),2)))*6378.137;
	$ss = explode(".",$s);
	return '距离我'.$ss[0].'.'.substr($ss[1] , 0 , 2).'公里';
}

function get_words_keywords_str($content){
	require_once APPPATH . 'third_party/words/phpanalysis.class.php';
	PhpAnalysis::$loadInit = false;
	$pa = new PhpAnalysis('utf-8', 'utf-8', false);
	$pa->LoadDict();
	$pa->SetSource($content);
	$pa->StartAnalysis( false );
	$tags = $pa->GetFinallyResult();
	return $tags;
}
function pp($bool=false)
{
    list($callee) = debug_backtrace();
    $arguments = func_get_args();
    $totalArguments = count($arguments);

    echo "<fieldset class='dump'>" . PHP_EOL .
        "<legend>{$callee['file']} @ line: {$callee['line']}</legend>" . PHP_EOL .
        '<pre>';

    $i = 0;
    foreach ($arguments as $argument) {
        echo '<br /><strong>Debug #' . (++$i) . " of {$totalArguments}</strong>: ";

        if (! empty($argument)
            && (is_array($argument) || is_object($argument))
        ) {
            print_r($argument);
        } else {
            var_dump($argument);
        }
    }

    echo '</pre>' . PHP_EOL .
        '</fieldset>' . PHP_EOL;
    if(!$bool){

    }
}
if (!function_exists('getallheaders')) {
    function getallheaders() {
        foreach ($_SERVER as $name => $value) {
            if (substr($name, 0, 5) == 'HTTP_') {
                $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
            }
        }
        return $headers;
    }
}

function get_jianlou_image($file_location,$file_name,$size = "big"){
    if(file_exists(FCPATH.$file_location.$size."_".$file_name)){
        return base_url($file_location.$size."_".$file_name);
    }else{
        return base_url($file_location.$file_name);
    }
}

/** 兼容key没有双引括起来的JSON字符串解析
* @param String $str JSON字符串
* @param boolean $mod true:Array,false:Object
* @return Array/Object
*/
function ext_json_decode($str, $mode=false){
  if(preg_match('/\w:/', $str)){
    $str = preg_replace('/(\w+):/is', '"$1":', $str);
  }
  return json_decode($str, $mode);
}


//取出详情的所有图片
function getimgs($content,$order='ALL'){
    $pattern="/<img.*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
    preg_match_all($pattern,$content,$match);
    if(isset($match[1])&&!empty($match[1])){
        if($order==='ALL'){
            return $match[1];
        }
        if(is_numeric($order)&&isset($match[1][$order])){
            return $match[1][$order];
        }
    }
    return '';
}

//取机产生几个机器模拟
function push_user_old($num=10)
{
	$tou=array('快乐','冷静','醉熏','潇洒','糊涂','积极','冷酷','深情','粗暴','温柔','可爱','愉快','义气','认真','威武','帅气','传统','潇洒','漂亮','自然','专一','听话','昏睡','狂野','等待','搞怪','幽默','魁梧','活泼','开心','高兴','超帅','留胡子','坦率','直率','轻松','痴情','完美','精明','无聊','有魅力','丰富','繁荣','饱满','炙热','暴躁','碧蓝','俊逸','英勇','健忘','故意','无心','土豪','朴实','兴奋','幸福','淡定','不安','阔达','孤独','独特','疯狂','时尚','落后','风趣','忧伤','大胆','爱笑','矮小','健康','合适','玩命','沉默','斯文','香蕉','苹果','鲤鱼','鳗鱼','任性','细心','粗心','大意','甜甜','酷酷','健壮','英俊','霸气','阳光','默默','大力','孝顺','忧虑','着急','紧张','善良','凶狠','害怕','重要','危机','欢喜','欣慰','满意','跳跃','诚心','称心','如意','怡然','娇气','无奈','无语','激动','愤怒','美好','感动','激情','激昂','震动','虚拟','超级','寒冷','精明','明理','犹豫','忧郁','寂寞','奋斗','勤奋','现代','过时','稳重','热情','含蓄','开放','无辜','多情','纯真','拉长','热心','从容','体贴','风中','曾经','追寻','儒雅','优雅','开朗','外向','内向','清爽','文艺','长情','平常','单身','伶俐','高大','懦弱','柔弱','爱笑','乐观','耍酷','酷炫','神勇','年轻','唠叨','瘦瘦','无情','包容','顺心','畅快','舒适','靓丽','负责','背后','简单','谦让','彩色','缥缈','欢呼','生动','复杂','慈祥','仁爱','魔幻','虚幻','淡然','受伤','雪白','高高','糟糕','顺利','闪闪','羞涩','缓慢','迅速','优秀','聪明','含糊','俏皮','淡淡','坚强','平淡','欣喜','能干','灵巧','友好','机智','机灵','正直','谨慎','俭朴','殷勤','虚心','辛勤','自觉','无私','无限','踏实','老实','现实','可靠','务实','拼搏','个性','粗犷','活力','成就','勤劳','单纯','落寞','朴素','悲凉','忧心','洁净','清秀','自由','小巧','单薄','贪玩','刻苦','干净','壮观','和谐','文静','调皮','害羞','安详','自信','端庄','坚定','美满','舒心','温暖','专注','勤恳','美丽','腼腆','优美','甜美','甜蜜','整齐','动人','典雅','尊敬','舒服','妩媚','秀丽','喜悦','甜美','彪壮','强健','大方','俊秀','聪慧','迷人','陶醉','悦耳','动听','明亮','结实','魁梧','标致','清脆','敏感','光亮','大气','老迟到','知性','冷傲','呆萌','野性','隐形','笑点低','微笑','笨笨','难过','沉静','火星上','失眠','安静','纯情','要减肥','迷路','烂漫','哭泣','贤惠','苗条','温婉','发嗲','会撒娇','贪玩','执着','眯眯眼','花痴','想人陪','眼睛大','高贵','傲娇','心灵美','爱撒娇','细腻','天真','怕黑','感性','飘逸','怕孤独','忐忑','高挑','傻傻','冷艳','爱听歌','还单身','怕孤单','懵懂');
	$do = array("的","爱","","与","给","扯","和","用","方","打","就","迎","向","踢","笑","闻","有","等于","保卫","演变");
	$wei=array('嚓茶','凉面','便当','毛豆','花生','可乐','灯泡','哈密瓜','野狼','背包','眼神','缘分','雪碧','人生','牛排','蚂蚁','飞鸟','灰狼','斑马','汉堡','悟空','巨人','绿茶','自行车','保温杯','大碗','墨镜','魔镜','煎饼','月饼','月亮','星星','芝麻','啤酒','玫瑰','大叔','小伙','哈密瓜，数据线','太阳','树叶','芹菜','黄蜂','蜜粉','蜜蜂','信封','西装','外套','裙子','大象','猫咪','母鸡','路灯','蓝天','白云','星月','彩虹','微笑','摩托','板栗','高山','大地','大树','电灯胆','砖头','楼房','水池','鸡翅','蜻蜓','红牛','咖啡','机器猫','枕头','大船','诺言','钢笔','刺猬','天空','飞机','大炮','冬天','洋葱','春天','夏天','秋天','冬日','航空','毛衣','豌豆','黑米','玉米','眼睛','老鼠','白羊','帅哥','美女','季节','鲜花','服饰','裙子','白开水','秀发','大山','火车','汽车','歌曲','舞蹈','老师','导师','方盒','大米','麦片','水杯','水壶','手套','鞋子','自行车','鼠标','手机','电脑','书本','奇迹','身影','香烟','夕阳','台灯','宝贝','未来','皮带','钥匙','心锁','故事','花瓣','滑板','画笔','画板','学姐','店员','电源','饼干','宝马','过客','大白','时光','石头','钻石','河马','犀牛','西牛','绿草','抽屉','柜子','往事','寒风','路人','橘子','耳机','鸵鸟','朋友','苗条','铅笔','钢笔','硬币','热狗','大侠','御姐','萝莉','毛巾','期待','盼望','白昼','黑夜','大门','黑裤','钢铁侠','哑铃','板凳','枫叶','荷花','乌龟','仙人掌','衬衫','大神','草丛','早晨','心情','茉莉','流沙','蜗牛','战斗机','冥王星','猎豹','棒球','篮球','乐曲','电话','网络','世界','中心','鱼','鸡','狗','老虎','鸭子','雨','羽毛','翅膀','外套','火','丝袜','书包','钢笔','冷风','八宝粥','烤鸡','大雁','音响','招牌','胡萝卜','冰棍','帽子','菠萝','蛋挞','香水','泥猴桃','吐司','溪流','黄豆','樱桃','小鸽子','小蝴蝶','爆米花','花卷','小鸭子','小海豚','日记本','小熊猫','小懒猪','小懒虫','荔枝','镜子','曲奇','金针菇','小松鼠','小虾米','酒窝','紫菜','金鱼','柚子','果汁','百褶裙','项链','帆布鞋','火龙果','奇异果','煎蛋','唇彩','小土豆','高跟鞋','戒指','雪糕','睫毛','铃铛','手链','香氛','红酒','月光','酸奶','银耳汤','咖啡豆','小蜜蜂','小蚂蚁','蜡烛','棉花糖','向日葵','水蜜桃','小蝴蝶','小刺猬','小丸子','指甲油','康乃馨','糖豆','薯片','口红','超短裙','乌冬面','冰淇淋','棒棒糖','长颈鹿','豆芽','发箍','发卡','发夹','发带','铃铛','小馒头','小笼包','小甜瓜','冬瓜','香菇','小兔子','含羞草','短靴','睫毛膏','小蘑菇','跳跳糖','小白菜','草莓','柠檬','月饼','百合','纸鹤','小天鹅','云朵','芒果','面包','海燕','小猫咪','龙猫','唇膏','鞋垫','羊','黑猫','白猫','万宝路','金毛','山水','音响','尊云','西安');

	$data1 = array();
	for ($x=0; $x<$num; $x++) {
		$tou_num=rand(0,331);
		$do_num=rand(0,19);
		$wei_num=rand(0,255);

		$type = rand(0,1);
		if($type==0){
			$username=$tou[$tou_num].$do[$do_num].$wei[$wei_num];
		}else{
			$username=$wei[$wei_num].$tou[$tou_num];
		}
	  	$data1[$x]["avatar"] = base_url('public/machines/'.$wei_num.'.jpg');
        $data1[$x]["user_name"] = $username;
        $data1[$x]["time"] = '刚刚';
        $data1[$x]["content"] = "捡漏成功";
	} 
	return $data1;
}

//取机产生几个机器模拟
function push_user($num=10)
{
	$uall = array('凉风有信','花猫的哀怨','孤岛寻梦','最美的梵音','情到浓时爱终远','爱太长时间太短','恍如梦','开心每一天','落雁沉鱼','我有想你','只偏袒你','热心公民','糖不及你甜','男人国的女人','像风又像雨','快点长大','擒拿你的心','良辰不负美景','有你才会暖','我深爱的人','属于我的童话','左心房','一米阳光','怪人终遇良人','若水盈盈','路途遥远','甜心苦口','安之若素','归属','孑然一身','念你如初','曲终人散','假装快乐','泛黄的日记','真心换假意','流言太吵','狠狠爱自己','人生巅峰','貌似小傻子','捧着幸福流泪','秋天不回来','直说人','有志者事竟成','怒放的生命','追梦赤子心','苦尽甜来','理想与现实','穷也别怂','此时定此生','处变不惊','痛定思痛','我的明天不NG','像快乐奔跑','何必自讨无趣','低调的90后','回光不返照','强颜欢笑','一路有繁花','初晴','春风十里','云朵有点甜','青柠檬檬哒','与幸福相约','浅笑安然','纯情小奶牛','仙女下凡脸着地','欠我一个未来','哇哈哈','词穷中','不合群的人','吹不散的乡愁','抠脚的女汉子','一个世纪之长','抛弃曾经','努力操控一切','谁能久伴不走','不再说从前','泪过无痕','幸福时常缺货','多像笑话','等待白了青丝','时光在作祟','不见亦不念','小巷里的猫','躲在被窝里哭','一念花开','焦糖玛奇朵','打小像祖宗','美丑一张脸','飘落的花蕊','有恃无恐','假慈悲','独奏夜上弦','东方彧卿','北风吹','血染墨家','风卷残衣','恰似你的温柔','时光蹉跎了容颜','明恋可怕','肤浅皮太黑','怀疑一切','一杯敬相逢','无法抗拒','爱是蒸的','骑着乌龟追兔子','借风抱你','巴黎塔下听雨','南街北巷','正在输入','恰好心动','戏子','刘希子','务必善良','三分之一阳光','拥挤的人心','怪你过分温柔','潮湿的心','怪性笑人','三个字对不起','阳光下的水滴','岁月的讽刺','时光倒影','挥不去的执着','谁也留不住','回忆总想哭','无法企及的光','空洞的大脑','无言的结局','泡沫易醉','姓胡不幸福','点背不能怨社会','女人就要美','柠檬不萌','自然卷毛','大不正经','散了累了','七分流氓','有云才下雨','三分书生气','紫藤花开','秋风落叶情','顺水低山','北冰洋的雨','山那边是海','姜太公的鱼','红梅千雪','青衫依旧','仙女下凡','从简','熬夜的小猪','大乔','渡劫的青蛙','软耳猫猫','瘦？不容易','智商只够卖萌','习惯依赖','孤寡老人','粗人一枚','不三也不四','傲君子','枉生','柳序生','笑忘路','叶子','野子','邮递员','颓废的胖子','各自安好','唐老师','夜夜夜太静','放过自己','暗夜残星','小鹿乱撞','相遇太难','梦浅易醒','花开在心','兔子毛的顶端','玻璃瓶的回忆','一叶一春秋','一叶扁舟','孤山迷情客','傻狍子','仅剩一个字','活得比天狂','不打马赛克','昵称不存在','傻二呆','绿色的小屋','猥琐先森','丁香姑娘','泡沫之夏','乡村灰姑娘','雪花那个飘','维他命','绝版女王','我要我们在一起','背影里沉默','勿相拥','二手贩子','贞子和我','单曲循环','狗友不友','低八度','猫街少女','我心切望','草莓熊','天长长，月光光','粉红色的夏天','病态妹子','大妈气质','身份ID','梦里水乡','乖妞妞','朕好萌','农村代表','放下伪装','兜兜转转','火花与花火','农药救命','银色手链','禁止盗版','从头做人','洗心革面','剪刀石头布','街角唱情歌','细节拯救爱情','青蛙变王子','正义的化身','扛把子','命中注定','坚持','断线的风筝','高调的沉默','东方白菜','庸俗的结局','易拉罐','戒不掉的傻笑','低到尘埃','一起续写未来','问心有愧','动感光波','化学反应','24K纯傻','穿条纹的男孩','最佳拍档','抱着手机说宝贝','旺旺大馒头','想去拉萨','亦凡粉','流火如夏','只想毛爷爷','柳树湾湾','晚霞无限好','大树','二愣子','奔跑吧！','京城鹿爷','人字拖毁世界','豹的速度','土豆你个番茄','麻辣你个香锅','我想做学霸','手机是真爱','地球是圆的','喜欢独乐乐','怀念迈克','土豆土豆丝','熊大熊二','大头蚊子','心软脾气硬','余额不足','首尔小白眼','边村长','再见青春','一起长大的约定','钻石王老六','橙让橙让','饮而尽','文艺老痞子','猪拱人肺','给我唱征服','老当益壮','姜还是老的辣','老牛拉车','幸福连连看','日月同辉','可可西里','诚信做人','向往的生活','小眼睛','泡芙','拂晓','迷鸟归林','八支玫瑰','枫叶落落','北风南飞','老车新路','共度朝夕','网上近邻','临窗观景','爱入骨髓','未完待续','麦芽糖糖','森碟姐姐','两小无猜','日落余晖','樱花烟雨','不一样的天空','绅士格','势在必得','年轻不是罪','次要人物','白头吟','赐君一席盛宴','自作多情小角落','伊人泪满面','赠卿长梦','烟瘾入喉','吟花入酒','清风百里','细雨情诗','把星星藏你眼里','痞子没有爱','淳朴的光芒','两戳小胡子','老松树','英俊庄稼人','学会珍惜','快乐的枝干','看透炎凉事','心淡如菊','人生就像棋局','雾中的风景','没有承诺的梦','生命如流水','青葱的岁月','清醒的糊涂人','午后的斜阳','成功的画卷','憧憬的路','奇迹的价格','三十不惑','恨不能遗忘','残缺的美丽','暗香袭人','已风干的迷茫','空谷幽幽','删除过去','一世两相依','淡墨轻衫','细品岁月','滴水石穿','闲云野鹤','','上善若水','我比想象中勇敢','倒转流连','笑面虎','一荣一枯皆眼尘','几许和谐','检修的车轮','午后的一轮斜阳','老马与小马','人老心不老','月伴终生','傲骨女人花','夕颜如梦','拐角处的那一幕','潮湿的心','返璞归真','挥笔题书','读不厌倦的诗','刀马旦','独上西楼','游戏人间','高天上流云','扑火','大漠孤烟','雨做的云','辞令','蜕变','黛眉勾画','且辞扶苏','天空丢了','鹊桥行','二月初二','游人久歌','西柚卡片','知了与冬','古老的传言','午后的走廊','陌生的亲吻','奥斯卡影后','拂尘轻摇','陪伴','福星高照','东先森','狂野绅士','怪蜀黍','可乐的乐','混世魔王','请叫我无聊姐','遗落的童年','蒹葭苍苍遇见你','人生不要初见','东街二号','承蒙你的不弃','砍柴少年','怀念不如相见','神勇奇兵','异类','小红帽的大灰狼','斑马的爱','巧克力汉堡','悟空转世','深海的鱼','溺水的鱼','东方霸主','勤劳的铲屎官','时光磨人','墙内人的苦与泪','我怕来不及','最美不过你的笑','梦回故里','萨摩耶的爸爸','星星点灯','忐忑的皮囊','坏人也善良','精致的黑玫瑰','大叔的坏小孩','西瓜你个思密达','故事从结局开始','深得我心','全靠演技','不良人','奔跑的金吉拉','小逗比','红茶配奶昔','蜜蜂的甜腻','不是富二代','读书人','醉酒的龙猫','两只眼的二郎神','大象与老鼠','我叫小强强','童话化为泡影','荒岛救命','文艺小青年','白云与黑土','流浪的猪','水灵灵的招财猫','凯撒的爱','俗气的村姑','杯与水','流泪的冰激淋','念念不忘的伤','大树好乘凉','疯丫头','奥特曼的小怪兽','深情不久伴','叮当叮当','粉红色的阿狸','我要的只是你','红牛不牛','咖啡与烈酒','机器猫不是喵','暖阳的冬日','搁浅的大船','青春的帆','无期限的等待','刺猬与兔子','天马行空','叫我小橙子','死了还要爱','苏格兰的裙子','洋葱的眼泪','春天去又来','忧郁的向日葵','秋风扫落叶','墙角画圈圈','后悔无期','带静电的毛衣','人潮之中选中你','聪明的铁蛋','无法续写的结局','1楼不是人','优乐美我不美','转身就是全世界','不画眉毛的美女','奇葩的格调','小小的超人','鲜花与牛粪','牛仔裤的夏天','妩媚百褶裙','白开水加盐','乌龙茶','糖糖的糖','一个汉子','我宣你','情深缘浅','独臂舞者','宁可从没遇见','局外人','方盒的音乐','白米饭泡水','双面人皮','吃货不好惹','匹诺曹','黑白手套','玛丽亚的悲伤','浮云飘飘','鼠标不爱鼠标垫','布丁与草莓','日记本的故事','一颗冰冷的心','爱琴海与爱情','累觉不爱','自杀的香烟','危险的夕阳','奶茶小哥哥','甜蜜宝贝','波西米亚风','草编戒指','钥匙与锁','旧时心愿','故事没有结局','爱花钱的穷人','向天再借五百块','贫穷是硬伤','晚街听风','初梦良人','映山红','甜酱冰淇淋','顽皮小金刚','宝马不是马','万千过客','大白的拥抱','一只小强','破茧成蝶','钻石的心','河马吃草','等你来','北海道','给你的情书','栀子花开','潇洒的贵族','落魄的王子','寒风入骨成伤','路人甲','橘子绿了','北方的故事','鸵鸟起飞','月依秋水','蓝天碧海','春水繁星','朝花夕拾','莫名的小悲哀','热狗不是狗','无剑大侠','御姐音','萝莉音','抒情者','半夏','弥云裳','柠檬不甜','倩雪','花样作死','猫与友','钢铁侠','青瓷','不一样的天空','枫叶满地红','小白菜','乌龟的梦想','离和殇','甜酱配沙拉','凡夫俗子','草丛里的蛐蛐','我为你转身','有喵腻','茉莉花开','流沙俱下','蜗牛的房子','侧颜杀','冥王星','猎豹速度','谁是谁的主角','穿篮球服的帅哥','繁华笙歌落','使徒行者','农夫与蛇','调情的男人','起风了','爱在江湖飘','落子无悔','陌上人','老虎怕猫','特别人士','翩翩五公子','纵情的欧巴桑','翅膀断了','让你投降','篝火','段子手','黄钻小男人','败北者','久等必失','全能八宝粥','南同学','孤飞的大雁','城里的月光','招牌菜','大白牙','油炸冰棍','帽子有颜色','超级菠萝','芝士蛋挞','百合香水','猕猴桃的爹','吐司不土','小桥流水','山中暮雪','红豆奶油','小鸽子的使命','小蝴蝶','爆米花与可乐','花卷馒头','小仙女很仙','小海豚的吻','深山隐士','国宝小熊猫','勤奋的小懒猪','狐狸雨','很乖很听话','南方爱情故事','曲奇饼干','乖乖的兔叽','松鼠的穴','小虾米的一生','酒窝剩酒','紫菜包饭','金鱼没有眼泪','柚子蜂蜜茶','西瓜果汁','走过泥泞路','珍珠项链','帆布鞋的青春','旧日旧时旧事','奇异果','陌若安生','云海里的云','小土豆','一双高跟鞋','爱情与戒指','女人如画似梦','长睫毛的小精灵','铃铛响当当','我的温柔很甜','香氛肥皂','红酒配辣条','月光下的舞曲','酸奶鸡蛋饼','抹不掉的轻狂','咖啡煮豆','活得心安理得','小蚂蚁搬家','蜡烛的荣光','棉花糖的味道','相思的苦','鱼的七秒记忆','扯淡的幸福','跳梁小丑','樱桃小丸子','你好！自由','康乃馨的话语','糖豆先生','薯片小姐','口红的独白','超短裙的诱惑','乌冬面的汤','只要你来疼','棒棒糖很棒','长颈鹿想低头','豆芽与绿叶','戴发箍的女人','青梅陪我到天荒','青春不等我','发带飘飘','掩耳盗铃','星星之火','小笼包','小甜瓜','冬瓜想减肥','香菇难受','小芭比','含羞草的秘密','低调人的伟大','大富翁','男人的柔软','俏皮的跳跳糖','芳华易逝','草莓之吻','浅浅的时光','大帅比','一起看花开','千纸鹤','小天鹅','起舞','奔腾的草泥马','刺青在背','繁星下祈祷','乐呵的海燕','花非花','别愧对自己','藕断丝连','暖言暖心','羊咩咩','橙七与柠七','白猫要洗澡','万宝路的格调','白色衬衫','山水之间','小新的眉毛','安静的雪','女王驾到','小小酥','爱要说出来','皆是蝼蚁','花儿与少年','唐伯虎点蚊香','安吉丽娜&宝宝','全村的希望','阳光和雨露','关伯兰在哭','前方高能','缘来如梦','爱已成往事','万世荣光','向日葵','天之弃子','笑对人生','习惯沉默','普通美女','1+1等于？','蜡笔没有小新','漂亮男人','快乐的王老五','冷静的铲屎官','彼岸花开','潇洒的绅士','糊涂的大魔王','积极的小人人','冷酷的思密达','深情的彗星少年','逝去的青春','温柔的野马','斑驳的心','愉快看世界','刺眼的光芒','认真是一种修养','威武的哈士奇','帅气的欧巴','霸气的王老五','耀眼的女神','漂亮的小可爱','无敌小金刚','专一的尤物','听话的霸主','昏睡的布偶猫','狂野的泰迪','等待好男人','搞怪的大叔','幽默的加菲猫','魁梧的铲屎官','活泼的萨摩耶','开心的可乐','知足是福','大叔要超帅','留胡子的猫咪','坦率的小青年','澎湃的心','做人要低调','做人要开心','孤独成瘾','狂拽紫微星','微醉二郎神','思念说个风听','花姑娘','心已冷','做你的流星雨','炙热的心','暴躁的小萌宠','嚣张给谁看','英俊的小丑','似水流年','相遇成伤','一叶知秋','无心的小女人','拼命的小笨笨','对你执念太深','幸福的小人人','粉色大象','淡定的书生','农夫三拳有点甜','淡定的养猫人','孤独忍者','独特的结局','气质女王','一箩筐的幸福','气质不俗的女神','风趣的异类','忧伤的太阳花','大胆书生','爱笑的眼睛','搞怪欧巴','久居我心的爱','下一站，很幸福','指尖落舞','沉默的刺猬','斯文的王老五','千人之中遇见你','苹果与鲜花','农村卡哇伊','鳗鱼的救赎','任性不分年龄','我只当配角','且行且珍惜','七月的太阳','酸酸甜甜不是我','自在的荒岛','不语却知心','英俊的博美犬','无情一身轻','阳光下的布偶猫','偏执与柔软','没心没肺的鱼','人海中孤独','忧虑的小眼神','疯癫与文明','农村混血儿','善良不是罪','凶狠的小猫咪','短腿的女王','专业挖墙脚','不着调的帅哥','欢喜鸳鸯','狂奔的蜗牛','余生都是你','跳跃的脉搏','终是梦一场','我是你的梦','如意郎君','伊人莫相忘','娇气傻娃娃','无奈的哈士奇','无语的人生','烈酒配清风','愤怒的小蜻蜓','有趣的灵魂','灵魂摆渡人','激情喂了狗','单身特卖会','淡定观世界','虚拟的人生','宇宙超级大美女','寒冷的夜','精明给谁看','偷腥的喵','懒癌晚期患者','忧郁是一种病','寂寞无人懂','奋斗的梦','勤奋是硬道理','当代最美女人','撩妹神人','稳如泰山','热情的菇凉','含蓄才是美','开放的真心','无辜的守望者','多情是种病','纯真的五公子','傲娇的村姑','一吻定情','从容的凯撒','体贴的机器猫','风中眼泪飘','曾经是你','追寻你的光','儒雅绅士','优雅的檀木琴','吻我别废话','外向的含羞草','匆匆过客','被嫌弃的猫','文艺范的超人','最好的告白','丑人才作怪','单身狗的悲哀','伶俐的小萌新','高大的小矮人','懦弱是因爱你','柔弱的钢铁侠','爱笑的向日葵','空杯敬岁月','耍酷的超人','酷炫的吉娃娃','神勇的金毛','牵手的美好','云上波涛','瘦弱的大胖子','蓝色的心海','岸上的荷花','夏日梧桐雨','思念的滋味','迟到的幸福','闪光的勋章','沦陷的心','风雨飘摇的夜','简单就是福','月白风自清','彩色的回忆','缥缈的未来','沉醉的月光','江湖套路多','无所畏惧的心','国产萨摩耶','起床困难户','蓦然回首间','虚幻的幸福','心病还得心药医','受伤的喵喵','拔凉拔凉的心','活出二货范','王老五的思密达','芝麻与西瓜','闪闪发光的人生','羞涩的钱包','我是伪学渣','看上你是我瞎','优秀的配角','聪明是一种品质','小姑娘的世界','俏皮的疯子','追风逐月','坚强的忍者','梦想在身边','我该往哪去','能干的小宝宝','奇迹定会出现','友好的大坏蛋','机智如我','机灵小光头','正直的大魔王','天使与恶魔','酷炫狂拽小少爷','殷勤的黄鼠狼','撒旦的礼物','辛勤的小蜜蜂','独享这个世界','今夕何夕','浅笑带梨花','踏实干活的美女','夜色未央','现实版王者','且听风云','残阳暮雪','时光不散','一笑解千愁','粗犷的老爷们儿','梦里寻他千百度','闭眼听风雨','北港初晴','一念执着的鱼','落寞好冷','灯火阑珊','繁花满地','太阳花下的彩虹','曼珠沙华','大大的梦想','自由飞翔的猪','只饮半盏','单薄的影子','贪玩的小野狼','花静幽然','杨柳依依','许你三生三世','张大强的世界','忠诚的泰迪','那年夏天遇见你','害羞的帅哥','指尖划过的流连','浮华乱世','竹林听风','前方的暗夜','人心叵测','抱着回忆流泪','温暖的弦','谁让我动了情','爱情是个坑','美丽心情','心里住着未亡人','时光易逝','纸短情长','起风的夏天','心碎了才懂','动人的小酒窝','忘了怎么笑','离人无归期','你再也不属于我','妩媚的小清新','空城旧忆','几生几世孤独人','从你的世界路过','赤道边缘','爱喝奶茶的妹妹','梅菜扣肉与麦兜','一缕芳香','有趣的皮囊','迷人小妖精','陶醉在你的笑里','心如荒岛','七姐的小屋','乐乐要快乐','黄昏爱人','魁梧的维多利亚','巴菲特的野心','遛狗的二傻子','太阳下的太阳雨','行走在冷风中','大器晚成','老迟到的园丁','夕阳与海','爱吃鱼的喵','呆萌的猴子','雨夜的寂寞','隐形的穷人','喜欢一个人笑','微笑的猫','笨笨是一只猪','没有记忆的鱼','地老与天荒','火星上的小树苗','失眠成瘾','安静的美男子','纯情喂了狗','吃饱了再减肥','迷路的灯塔','烂漫的小丸子','哭泣的女娲','轻弹一首离别','佛系少年','保温杯配枸杞','发嗲的猫','会撒娇的大恐龙','时光是个罪犯','一个人的旅行','眯眯眼的先森','花痴爱欧巴','想人陪的夜','相思入骨','高贵的乞丐','感情废物','心灵美的小恶魔','假装无所谓','回首楼已空','天真的小姐姐','怕黑的小哥哥','沾染无奈的人生','飘逸的三根毛','逃不掉的宿命','新人变旧梦','消逝的温柔','傻傻等良人','冷艳的埃及女王','爱听歌的非主流','还单身的单身狗','自舔伤口的猫','云淡风轻');
	$data1 = array();
	for ($x=0; $x<$num; $x++) {
		$do_num=rand(0,1050);
		$wei_num=rand(0,255);
		$username=$uall[$do_num];
	  	$data1[$x]["avatar"] = base_url('public/machines/'.$wei_num.'.jpg');
        $data1[$x]["user_name"] = $username;
        $data1[$x]["time"] = '刚刚';
        $data1[$x]["content"] = "捡漏成功";
	} 
	return $data1;
}

//取机产生几个机器模拟带价格
function push_user_price($num=10,$pricea=0)
{
	$uall = array('凉风有信','花猫的哀怨','孤岛寻梦','最美的梵音','情到浓时爱终远','爱太长时间太短','恍如梦','开心每一天','落雁沉鱼','我有想你','只偏袒你','热心公民','糖不及你甜','男人国的女人','像风又像雨','快点长大','擒拿你的心','良辰不负美景','有你才会暖','我深爱的人','属于我的童话','左心房','一米阳光','怪人终遇良人','若水盈盈','路途遥远','甜心苦口','安之若素','归属','孑然一身','念你如初','曲终人散','假装快乐','泛黄的日记','真心换假意','流言太吵','狠狠爱自己','人生巅峰','貌似小傻子','捧着幸福流泪','秋天不回来','直说人','有志者事竟成','怒放的生命','追梦赤子心','苦尽甜来','理想与现实','穷也别怂','此时定此生','处变不惊','痛定思痛','我的明天不NG','像快乐奔跑','何必自讨无趣','低调的90后','回光不返照','强颜欢笑','一路有繁花','初晴','春风十里','云朵有点甜','青柠檬檬哒','与幸福相约','浅笑安然','纯情小奶牛','仙女下凡脸着地','欠我一个未来','哇哈哈','词穷中','不合群的人','吹不散的乡愁','抠脚的女汉子','一个世纪之长','抛弃曾经','努力操控一切','谁能久伴不走','不再说从前','泪过无痕','幸福时常缺货','多像笑话','等待白了青丝','时光在作祟','不见亦不念','小巷里的猫','躲在被窝里哭','一念花开','焦糖玛奇朵','打小像祖宗','美丑一张脸','飘落的花蕊','有恃无恐','假慈悲','独奏夜上弦','东方彧卿','北风吹','血染墨家','风卷残衣','恰似你的温柔','时光蹉跎了容颜','明恋可怕','肤浅皮太黑','怀疑一切','一杯敬相逢','无法抗拒','爱是蒸的','骑着乌龟追兔子','借风抱你','巴黎塔下听雨','南街北巷','正在输入','恰好心动','戏子','刘希子','务必善良','三分之一阳光','拥挤的人心','怪你过分温柔','潮湿的心','怪性笑人','三个字对不起','阳光下的水滴','岁月的讽刺','时光倒影','挥不去的执着','谁也留不住','回忆总想哭','无法企及的光','空洞的大脑','无言的结局','泡沫易醉','姓胡不幸福','点背不能怨社会','女人就要美','柠檬不萌','自然卷毛','大不正经','散了累了','七分流氓','有云才下雨','三分书生气','紫藤花开','秋风落叶情','顺水低山','北冰洋的雨','山那边是海','姜太公的鱼','红梅千雪','青衫依旧','仙女下凡','从简','熬夜的小猪','大乔','渡劫的青蛙','软耳猫猫','瘦？不容易','智商只够卖萌','习惯依赖','孤寡老人','粗人一枚','不三也不四','傲君子','枉生','柳序生','笑忘路','叶子','野子','邮递员','颓废的胖子','各自安好','唐老师','夜夜夜太静','放过自己','暗夜残星','小鹿乱撞','相遇太难','梦浅易醒','花开在心','兔子毛的顶端','玻璃瓶的回忆','一叶一春秋','一叶扁舟','孤山迷情客','傻狍子','仅剩一个字','活得比天狂','不打马赛克','昵称不存在','傻二呆','绿色的小屋','猥琐先森','丁香姑娘','泡沫之夏','乡村灰姑娘','雪花那个飘','维他命','绝版女王','我要我们在一起','背影里沉默','勿相拥','二手贩子','贞子和我','单曲循环','狗友不友','低八度','猫街少女','我心切望','草莓熊','天长长，月光光','粉红色的夏天','病态妹子','大妈气质','身份ID','梦里水乡','乖妞妞','朕好萌','农村代表','放下伪装','兜兜转转','火花与花火','农药救命','银色手链','禁止盗版','从头做人','洗心革面','剪刀石头布','街角唱情歌','细节拯救爱情','青蛙变王子','正义的化身','扛把子','命中注定','坚持','断线的风筝','高调的沉默','东方白菜','庸俗的结局','易拉罐','戒不掉的傻笑','低到尘埃','一起续写未来','问心有愧','动感光波','化学反应','24K纯傻','穿条纹的男孩','最佳拍档','抱着手机说宝贝','旺旺大馒头','想去拉萨','亦凡粉','流火如夏','只想毛爷爷','柳树湾湾','晚霞无限好','大树','二愣子','奔跑吧！','京城鹿爷','人字拖毁世界','豹的速度','土豆你个番茄','麻辣你个香锅','我想做学霸','手机是真爱','地球是圆的','喜欢独乐乐','怀念迈克','土豆土豆丝','熊大熊二','大头蚊子','心软脾气硬','余额不足','首尔小白眼','边村长','再见青春','一起长大的约定','钻石王老六','橙让橙让','饮而尽','文艺老痞子','猪拱人肺','给我唱征服','老当益壮','姜还是老的辣','老牛拉车','幸福连连看','日月同辉','可可西里','诚信做人','向往的生活','小眼睛','泡芙','拂晓','迷鸟归林','八支玫瑰','枫叶落落','北风南飞','老车新路','共度朝夕','网上近邻','临窗观景','爱入骨髓','未完待续','麦芽糖糖','森碟姐姐','两小无猜','日落余晖','樱花烟雨','不一样的天空','绅士格','势在必得','年轻不是罪','次要人物','白头吟','赐君一席盛宴','自作多情小角落','伊人泪满面','赠卿长梦','烟瘾入喉','吟花入酒','清风百里','细雨情诗','把星星藏你眼里','痞子没有爱','淳朴的光芒','两戳小胡子','老松树','英俊庄稼人','学会珍惜','快乐的枝干','看透炎凉事','心淡如菊','人生就像棋局','雾中的风景','没有承诺的梦','生命如流水','青葱的岁月','清醒的糊涂人','午后的斜阳','成功的画卷','憧憬的路','奇迹的价格','三十不惑','恨不能遗忘','残缺的美丽','暗香袭人','已风干的迷茫','空谷幽幽','删除过去','一世两相依','淡墨轻衫','细品岁月','滴水石穿','闲云野鹤','','上善若水','我比想象中勇敢','倒转流连','笑面虎','一荣一枯皆眼尘','几许和谐','检修的车轮','午后的一轮斜阳','老马与小马','人老心不老','月伴终生','傲骨女人花','夕颜如梦','拐角处的那一幕','潮湿的心','返璞归真','挥笔题书','读不厌倦的诗','刀马旦','独上西楼','游戏人间','高天上流云','扑火','大漠孤烟','雨做的云','辞令','蜕变','黛眉勾画','且辞扶苏','天空丢了','鹊桥行','二月初二','游人久歌','西柚卡片','知了与冬','古老的传言','午后的走廊','陌生的亲吻','奥斯卡影后','拂尘轻摇','陪伴','福星高照','东先森','狂野绅士','怪蜀黍','可乐的乐','混世魔王','请叫我无聊姐','遗落的童年','蒹葭苍苍遇见你','人生不要初见','东街二号','承蒙你的不弃','砍柴少年','怀念不如相见','神勇奇兵','异类','小红帽的大灰狼','斑马的爱','巧克力汉堡','悟空转世','深海的鱼','溺水的鱼','东方霸主','勤劳的铲屎官','时光磨人','墙内人的苦与泪','我怕来不及','最美不过你的笑','梦回故里','萨摩耶的爸爸','星星点灯','忐忑的皮囊','坏人也善良','精致的黑玫瑰','大叔的坏小孩','西瓜你个思密达','故事从结局开始','深得我心','全靠演技','不良人','奔跑的金吉拉','小逗比','红茶配奶昔','蜜蜂的甜腻','不是富二代','读书人','醉酒的龙猫','两只眼的二郎神','大象与老鼠','我叫小强强','童话化为泡影','荒岛救命','文艺小青年','白云与黑土','流浪的猪','水灵灵的招财猫','凯撒的爱','俗气的村姑','杯与水','流泪的冰激淋','念念不忘的伤','大树好乘凉','疯丫头','奥特曼的小怪兽','深情不久伴','叮当叮当','粉红色的阿狸','我要的只是你','红牛不牛','咖啡与烈酒','机器猫不是喵','暖阳的冬日','搁浅的大船','青春的帆','无期限的等待','刺猬与兔子','天马行空','叫我小橙子','死了还要爱','苏格兰的裙子','洋葱的眼泪','春天去又来','忧郁的向日葵','秋风扫落叶','墙角画圈圈','后悔无期','带静电的毛衣','人潮之中选中你','聪明的铁蛋','无法续写的结局','1楼不是人','优乐美我不美','转身就是全世界','不画眉毛的美女','奇葩的格调','小小的超人','鲜花与牛粪','牛仔裤的夏天','妩媚百褶裙','白开水加盐','乌龙茶','糖糖的糖','一个汉子','我宣你','情深缘浅','独臂舞者','宁可从没遇见','局外人','方盒的音乐','白米饭泡水','双面人皮','吃货不好惹','匹诺曹','黑白手套','玛丽亚的悲伤','浮云飘飘','鼠标不爱鼠标垫','布丁与草莓','日记本的故事','一颗冰冷的心','爱琴海与爱情','累觉不爱','自杀的香烟','危险的夕阳','奶茶小哥哥','甜蜜宝贝','波西米亚风','草编戒指','钥匙与锁','旧时心愿','故事没有结局','爱花钱的穷人','向天再借五百块','贫穷是硬伤','晚街听风','初梦良人','映山红','甜酱冰淇淋','顽皮小金刚','宝马不是马','万千过客','大白的拥抱','一只小强','破茧成蝶','钻石的心','河马吃草','等你来','北海道','给你的情书','栀子花开','潇洒的贵族','落魄的王子','寒风入骨成伤','路人甲','橘子绿了','北方的故事','鸵鸟起飞','月依秋水','蓝天碧海','春水繁星','朝花夕拾','莫名的小悲哀','热狗不是狗','无剑大侠','御姐音','萝莉音','抒情者','半夏','弥云裳','柠檬不甜','倩雪','花样作死','猫与友','钢铁侠','青瓷','不一样的天空','枫叶满地红','小白菜','乌龟的梦想','离和殇','甜酱配沙拉','凡夫俗子','草丛里的蛐蛐','我为你转身','有喵腻','茉莉花开','流沙俱下','蜗牛的房子','侧颜杀','冥王星','猎豹速度','谁是谁的主角','穿篮球服的帅哥','繁华笙歌落','使徒行者','农夫与蛇','调情的男人','起风了','爱在江湖飘','落子无悔','陌上人','老虎怕猫','特别人士','翩翩五公子','纵情的欧巴桑','翅膀断了','让你投降','篝火','段子手','黄钻小男人','败北者','久等必失','全能八宝粥','南同学','孤飞的大雁','城里的月光','招牌菜','大白牙','油炸冰棍','帽子有颜色','超级菠萝','芝士蛋挞','百合香水','猕猴桃的爹','吐司不土','小桥流水','山中暮雪','红豆奶油','小鸽子的使命','小蝴蝶','爆米花与可乐','花卷馒头','小仙女很仙','小海豚的吻','深山隐士','国宝小熊猫','勤奋的小懒猪','狐狸雨','很乖很听话','南方爱情故事','曲奇饼干','乖乖的兔叽','松鼠的穴','小虾米的一生','酒窝剩酒','紫菜包饭','金鱼没有眼泪','柚子蜂蜜茶','西瓜果汁','走过泥泞路','珍珠项链','帆布鞋的青春','旧日旧时旧事','奇异果','陌若安生','云海里的云','小土豆','一双高跟鞋','爱情与戒指','女人如画似梦','长睫毛的小精灵','铃铛响当当','我的温柔很甜','香氛肥皂','红酒配辣条','月光下的舞曲','酸奶鸡蛋饼','抹不掉的轻狂','咖啡煮豆','活得心安理得','小蚂蚁搬家','蜡烛的荣光','棉花糖的味道','相思的苦','鱼的七秒记忆','扯淡的幸福','跳梁小丑','樱桃小丸子','你好！自由','康乃馨的话语','糖豆先生','薯片小姐','口红的独白','超短裙的诱惑','乌冬面的汤','只要你来疼','棒棒糖很棒','长颈鹿想低头','豆芽与绿叶','戴发箍的女人','青梅陪我到天荒','青春不等我','发带飘飘','掩耳盗铃','星星之火','小笼包','小甜瓜','冬瓜想减肥','香菇难受','小芭比','含羞草的秘密','低调人的伟大','大富翁','男人的柔软','俏皮的跳跳糖','芳华易逝','草莓之吻','浅浅的时光','大帅比','一起看花开','千纸鹤','小天鹅','起舞','奔腾的草泥马','刺青在背','繁星下祈祷','乐呵的海燕','花非花','别愧对自己','藕断丝连','暖言暖心','羊咩咩','橙七与柠七','白猫要洗澡','万宝路的格调','白色衬衫','山水之间','小新的眉毛','安静的雪','女王驾到','小小酥','爱要说出来','皆是蝼蚁','花儿与少年','唐伯虎点蚊香','安吉丽娜&宝宝','全村的希望','阳光和雨露','关伯兰在哭','前方高能','缘来如梦','爱已成往事','万世荣光','向日葵','天之弃子','笑对人生','习惯沉默','普通美女','1+1等于？','蜡笔没有小新','漂亮男人','快乐的王老五','冷静的铲屎官','彼岸花开','潇洒的绅士','糊涂的大魔王','积极的小人人','冷酷的思密达','深情的彗星少年','逝去的青春','温柔的野马','斑驳的心','愉快看世界','刺眼的光芒','认真是一种修养','威武的哈士奇','帅气的欧巴','霸气的王老五','耀眼的女神','漂亮的小可爱','无敌小金刚','专一的尤物','听话的霸主','昏睡的布偶猫','狂野的泰迪','等待好男人','搞怪的大叔','幽默的加菲猫','魁梧的铲屎官','活泼的萨摩耶','开心的可乐','知足是福','大叔要超帅','留胡子的猫咪','坦率的小青年','澎湃的心','做人要低调','做人要开心','孤独成瘾','狂拽紫微星','微醉二郎神','思念说个风听','花姑娘','心已冷','做你的流星雨','炙热的心','暴躁的小萌宠','嚣张给谁看','英俊的小丑','似水流年','相遇成伤','一叶知秋','无心的小女人','拼命的小笨笨','对你执念太深','幸福的小人人','粉色大象','淡定的书生','农夫三拳有点甜','淡定的养猫人','孤独忍者','独特的结局','气质女王','一箩筐的幸福','气质不俗的女神','风趣的异类','忧伤的太阳花','大胆书生','爱笑的眼睛','搞怪欧巴','久居我心的爱','下一站，很幸福','指尖落舞','沉默的刺猬','斯文的王老五','千人之中遇见你','苹果与鲜花','农村卡哇伊','鳗鱼的救赎','任性不分年龄','我只当配角','且行且珍惜','七月的太阳','酸酸甜甜不是我','自在的荒岛','不语却知心','英俊的博美犬','无情一身轻','阳光下的布偶猫','偏执与柔软','没心没肺的鱼','人海中孤独','忧虑的小眼神','疯癫与文明','农村混血儿','善良不是罪','凶狠的小猫咪','短腿的女王','专业挖墙脚','不着调的帅哥','欢喜鸳鸯','狂奔的蜗牛','余生都是你','跳跃的脉搏','终是梦一场','我是你的梦','如意郎君','伊人莫相忘','娇气傻娃娃','无奈的哈士奇','无语的人生','烈酒配清风','愤怒的小蜻蜓','有趣的灵魂','灵魂摆渡人','激情喂了狗','单身特卖会','淡定观世界','虚拟的人生','宇宙超级大美女','寒冷的夜','精明给谁看','偷腥的喵','懒癌晚期患者','忧郁是一种病','寂寞无人懂','奋斗的梦','勤奋是硬道理','当代最美女人','撩妹神人','稳如泰山','热情的菇凉','含蓄才是美','开放的真心','无辜的守望者','多情是种病','纯真的五公子','傲娇的村姑','一吻定情','从容的凯撒','体贴的机器猫','风中眼泪飘','曾经是你','追寻你的光','儒雅绅士','优雅的檀木琴','吻我别废话','外向的含羞草','匆匆过客','被嫌弃的猫','文艺范的超人','最好的告白','丑人才作怪','单身狗的悲哀','伶俐的小萌新','高大的小矮人','懦弱是因爱你','柔弱的钢铁侠','爱笑的向日葵','空杯敬岁月','耍酷的超人','酷炫的吉娃娃','神勇的金毛','牵手的美好','云上波涛','瘦弱的大胖子','蓝色的心海','岸上的荷花','夏日梧桐雨','思念的滋味','迟到的幸福','闪光的勋章','沦陷的心','风雨飘摇的夜','简单就是福','月白风自清','彩色的回忆','缥缈的未来','沉醉的月光','江湖套路多','无所畏惧的心','国产萨摩耶','起床困难户','蓦然回首间','虚幻的幸福','心病还得心药医','受伤的喵喵','拔凉拔凉的心','活出二货范','王老五的思密达','芝麻与西瓜','闪闪发光的人生','羞涩的钱包','我是伪学渣','看上你是我瞎','优秀的配角','聪明是一种品质','小姑娘的世界','俏皮的疯子','追风逐月','坚强的忍者','梦想在身边','我该往哪去','能干的小宝宝','奇迹定会出现','友好的大坏蛋','机智如我','机灵小光头','正直的大魔王','天使与恶魔','酷炫狂拽小少爷','殷勤的黄鼠狼','撒旦的礼物','辛勤的小蜜蜂','独享这个世界','今夕何夕','浅笑带梨花','踏实干活的美女','夜色未央','现实版王者','且听风云','残阳暮雪','时光不散','一笑解千愁','粗犷的老爷们儿','梦里寻他千百度','闭眼听风雨','北港初晴','一念执着的鱼','落寞好冷','灯火阑珊','繁花满地','太阳花下的彩虹','曼珠沙华','大大的梦想','自由飞翔的猪','只饮半盏','单薄的影子','贪玩的小野狼','花静幽然','杨柳依依','许你三生三世','张大强的世界','忠诚的泰迪','那年夏天遇见你','害羞的帅哥','指尖划过的流连','浮华乱世','竹林听风','前方的暗夜','人心叵测','抱着回忆流泪','温暖的弦','谁让我动了情','爱情是个坑','美丽心情','心里住着未亡人','时光易逝','纸短情长','起风的夏天','心碎了才懂','动人的小酒窝','忘了怎么笑','离人无归期','你再也不属于我','妩媚的小清新','空城旧忆','几生几世孤独人','从你的世界路过','赤道边缘','爱喝奶茶的妹妹','梅菜扣肉与麦兜','一缕芳香','有趣的皮囊','迷人小妖精','陶醉在你的笑里','心如荒岛','七姐的小屋','乐乐要快乐','黄昏爱人','魁梧的维多利亚','巴菲特的野心','遛狗的二傻子','太阳下的太阳雨','行走在冷风中','大器晚成','老迟到的园丁','夕阳与海','爱吃鱼的喵','呆萌的猴子','雨夜的寂寞','隐形的穷人','喜欢一个人笑','微笑的猫','笨笨是一只猪','没有记忆的鱼','地老与天荒','火星上的小树苗','失眠成瘾','安静的美男子','纯情喂了狗','吃饱了再减肥','迷路的灯塔','烂漫的小丸子','哭泣的女娲','轻弹一首离别','佛系少年','保温杯配枸杞','发嗲的猫','会撒娇的大恐龙','时光是个罪犯','一个人的旅行','眯眯眼的先森','花痴爱欧巴','想人陪的夜','相思入骨','高贵的乞丐','感情废物','心灵美的小恶魔','假装无所谓','回首楼已空','天真的小姐姐','怕黑的小哥哥','沾染无奈的人生','飘逸的三根毛','逃不掉的宿命','新人变旧梦','消逝的温柔','傻傻等良人','冷艳的埃及女王','爱听歌的非主流','还单身的单身狗','自舔伤口的猫','云淡风轻');
	$data1 = array();
	for ($x=0; $x<$num; $x++) {
		$do_num=rand(0,1050);
		$wei_num=rand(0,255);
		$price=rand($pricea*0.7,$pricea*1.3);
		$username=$uall[$do_num];
	  	$data1[$x]["avatar"] = base_url('public/machines/'.$wei_num.'.jpg');
        $data1[$x]["user_name"] = $username;
        $data1[$x]["time"] = '刚刚';
        $data1[$x]["order_price"] = number_format($price, 2, '.', '');
	} 
	return $data1;
}

//过滤图文中的行内样式

function  rehtmls($data){
	$data = preg_replace("/<em([^>]+)?>/i", "", $data);
	$data = preg_replace("/<\/em>/i", "", $data);
/*	$data = preg_replace("/<img([^>]+)?>/i", "", $data);*/
	$data = preg_replace("/<div([^>]+)?>/i", "", $data);
	$data = preg_replace("/<\/div>/i", "", $data);
	$data = preg_replace("/<table([^>]+)?>/i", "", $data);
	$data = preg_replace("/<\/table>/i", "", $data);
	$data = preg_replace("/<tr([^>]+)?>/i", "", $data);
	$data = preg_replace("/<\/tr>/i", "", $data);
	$data = preg_replace("/<td([^>]+)?>/i", "", $data);
	$data = preg_replace("/<\/td>/i", "", $data);
	$data = preg_replace("/<tbody([^>]+)?>/i", "", $data);
	$data = preg_replace("/<\/tbody>/i", "", $data);
	$data = preg_replace("/<strong([^>]+)?>/i", "<strong>", $data);
	$data = preg_replace("/<\/strong>/i", "</strong>", $data);
	$data = preg_replace("/<p([^>]+)?>/i", "<p>", $data);
	$data = preg_replace("/<span([^>]+)?>/i", "<span>", $data);
	$data = preg_replace("/<\/span>/i", "</span>", $data);
	$data = preg_replace("/<h1([^>]+)?>/i", "<h1>", $data);
    $data = preg_replace("/<\/h1>/i", "</h1>", $data);
	$data = preg_replace("/<h2([^>]+)?>/i", "<h2>", $data);
    $data = preg_replace("/<\/h2>/i", "</h2>", $data);
	$data = preg_replace("/<font([^>]+)?>/i", "<font>", $data);
	$data = preg_replace("/<\/font>/i", "</font>", $data);
	$data = preg_replace("/<center([^>]+)?>/i", "<center>", $data);
	$data = preg_replace("/<\/center>/i", "</center>", $data);
	$data = preg_replace("/<b ([^>]+)?>/i", "<b>", $data);
    $data = preg_replace("/<\/b>/i", "</b>", $data);

	return $data;
}

/* End of file function_helper.php */
/* Location: ./system/helpers/function_helper.php */